package com.woniuxy01;

//是你（继承关系 is a），还有你(包含关系)，一切拜托你
class Coffee{

    public String getCoffee(){
        return "Coffee";
    }

}

class MilkCoffee extends Coffee{

    Coffee coffee;

    public MilkCoffee(Coffee coffee) {
        this.coffee = coffee;
    }

    public String getCoffee(){
        return "Milk-"+coffee.getCoffee();
    }
}

class SugarCoffee extends Coffee{
    Coffee coffee;

    public SugarCoffee(Coffee coffee) {
        this.coffee = coffee;
    }

    public String getCoffee(){
        return "Sugar-"+coffee.getCoffee();
    }
}

class SaltCoffee extends Coffee {
    Coffee coffee;

    public SaltCoffee(Coffee coffee) {
        this.coffee = coffee;
    }

    public String getCoffee() {
        return "Salt-" + coffee.getCoffee();
    }
}

public class Test02 {

    public static void main(String[] args) {
        Coffee coffee1=new Coffee();
        System.out.println(coffee1.getCoffee());

        System.out.println(new MilkCoffee(new Coffee()).getCoffee());


        System.out.println(new SugarCoffee(new MilkCoffee(new Coffee())).getCoffee());
    }

}
